/* 
 * File:   NaryOperator.h
 * Author: Gab'z
 *
 * Created on 4 juin 2012, 11:41
 */

#ifndef NARYOPERATOR_H
#define	NARYOPERATOR_H

#include "../Operator.h"
#include "../../literal/Number.h"
#include "../../literal/Stack.h"

namespace calculator {

    class NaryOperator : public Operator {
    public:
        std::string isExecutable() const;
        virtual NaryOperator* clone() const = 0;

        const Memento* createMemento() const  throw (CommandException);

    protected:
        virtual const Number* apply(const Stack* stack) const throw (ArithmeticException) = 0;
        NaryOperator(const std::string name);
        virtual ~NaryOperator();
    private:
        void eval(Stack* stack) const throw (CommandException);
        NaryOperator(const NaryOperator& orig);
    };
}

#endif	/* NARYOPERATOR_H */

